﻿using Module.FlowChart.Logic;
using System.Drawing;

namespace Module.FlowChart.Model
{
    internal sealed class SequentialFCWorkPage : FCWorkPageBase
    {


        static public string TypeNameS = typeof(SequentialFCWorkPage).Name;
        public override string TypeName => TypeNameS;

        static void StaticInit()
        {
            string tname = TypeNameS;
            WorkPageLoaders[tname] = (br) =>
            {
                SequentialFCWorkPage re = new SequentialFCWorkPage();
                re.LoadFromBytes(br);
                return re;
            };
            WorkPageCreators[tname] = (name) =>
            {
                return new SequentialFCWorkPage(name);
            };
            WorkPageNameCreator[tname] = (index) =>
            {
                return "Page" + (index - 1);
            };
        }


        public SequentialFCWorkPage() : base()
        {
        }
        public SequentialFCWorkPage(string name) : base(name)
        {
            FCNode node1 = Nodes[AddNode(new FCNode(new Rectangle(100, 100, 100, 100), Shape.Circular, "开始"))];
            FCNode node2 = Nodes[AddNode(new FCNode(new Rectangle(300, 100, 100, 100), Shape.Circular, "结束"))];
            AddLine(new FCLine(node1.Id, node2.Id, 3, 1,
                LineManager.GetLinePoints(
                    node1.LogicRect, 3,
                    node2.LogicRect, 1)
                )
           );
        }
    }

}

